package org.dei.perla.rockfall.gui.queryforge;

import java.io.Serializable;
import java.lang.reflect.Method;

import org.dei.perla.sys.device.fpc.dspic.datastructures.MRP;

public class DSPicParameters implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private MRP parameter;

	public int getRs5() {
		return parameter.getRs5();
	}

	public int getRs6() {
		return parameter.getRs6();
	}

	public void setRs5(int rs5) {
		parameter.setRs5(rs5);
	}

	public void setRs6(int rs6) {
		parameter.setRs6(rs6);
	}

	private void initParams(){
		parameter.setAcquisitionType(0);
		parameter.setCommand(0xff);
		parameter.setCrackBias(0xab);
		parameter.setGx(0x1);
		parameter.setGy(0x2);
		parameter.setGz(0x4);
		parameter.setLtaInterSample(0xf0);
		parameter.setMx(0x8);
		parameter.setMy(0x10);
		parameter.setMz(0x20);
		parameter.setRs1(0x2107);
		parameter.setRs2(0x3751);
		parameter.setRs3(0x0000);
		parameter.setRs4(0x1786);
		parameter.setTapsx(null);
		parameter.setTapsy(null);
		parameter.setTapsz(null);
		//parameter.setThdwX(0);
		parameter.setRs5(0);
		parameter.setRs6(0);
		parameter.setThupX(0);
		parameter.setThupY(0);
		parameter.setThupZ(0);
	}
	
	public DSPicParameters(){
		parameter = new MRP();
		this.initParams();
	}
	
	public boolean equals(Object obj) {
		return parameter.equals(obj);
	}

	public int getAcquisitionType() {
		return parameter.getAcquisitionType();
	}

	public int getCommand() {
		return parameter.getCommand();
	}

	public int getCrackBias() {
		return parameter.getCrackBias();
	}

	public int getGx() {
		return parameter.getGx();
	}

	public int getGy() {
		return parameter.getGy();
	}

	public int getGz() {
		return parameter.getGz();
	}

	public int getLtaInterSample() {
		return parameter.getLtaInterSample();
	}

	public int getMx() {
		return parameter.getMx();
	}

	public int getMy() {
		return parameter.getMy();
	}

	public int getMz() {
		return parameter.getMz();
	}

	public int getRs1() {
		return parameter.getRs1();
	}

	public int getRs2() {
		return parameter.getRs2();
	}

	public int getRs3() {
		return parameter.getRs3();
	}

	public int getRs4() {
		return parameter.getRs4();
	}

	public int[] getTapsx() {
		return parameter.getTapsx();
	}

	public int[] getTapsy() {
		return parameter.getTapsy();
	}

	public int[] getTapsz() {
		return parameter.getTapsz();
	}

	public int getThupX() {
		return parameter.getThupX();
	}

	public int getThupY() {
		return parameter.getThupY();
	}

	public int getThupZ() {
		return parameter.getThupZ();
	}

	public int hashCode() {
		return parameter.hashCode();
	}

	public void setAcquisitionType(int acquisitionType) {
		parameter.setAcquisitionType(acquisitionType);
	}

	public void setCommand(int command) {
		parameter.setCommand(command);
	}

	public void setCrackBias(int crackBias) {
		parameter.setCrackBias(crackBias);
	}

	public void setGx(int gx) {
		parameter.setGx(gx);
	}

	public void setGy(int gy) {
		parameter.setGy(gy);
	}

	public void setGz(int gz) {
		parameter.setGz(gz);
	}

	public void setLtaInterSample(int thdwX) {
		parameter.setLtaInterSample(thdwX);
	}

	public void setMx(int mx) {
		parameter.setMx(mx);
	}

	public void setMy(int my) {
		parameter.setMy(my);
	}

	public void setMz(int mz) {
		parameter.setMz(mz);
	}

	public void setRs1(int rs1) {
		parameter.setRs1(rs1);
	}

	public void setRs2(int rs2) {
		parameter.setRs2(rs2);
	}

	public void setRs3(int rs3) {
		parameter.setRs3(rs3);
	}

	public void setRs4(int rs4) {
		parameter.setRs4(rs4);
	}

	public void setTapsx(int[] tapsx) {
		parameter.setTapsx(tapsx);
	}

	public void setTapsy(int[] tapsy) {
		parameter.setTapsy(tapsy);
	}

	public void setTapsz(int[] tapsz) {
		parameter.setTapsz(tapsz);
	}

	public void setThupX(int thupX) {
		parameter.setThupX(thupX);
	}

	public void setThupY(int thupY) {
		parameter.setThupY(thupY);
	}

	public void setThupZ(int thupZ) {
		parameter.setThupZ(thupZ);
	}
	public String toString(){
		String retVal = new String();
		System.out.println(this.parameter.getAcquisitionType());
		retVal = retVal.concat("SET acquisitionType=" + this.getAcquisitionType() + ", ");
		retVal = retVal.concat("command="+ this.getCommand() + ", ");
		retVal = retVal.concat("rs1="+ this.getRs1() + ", ");
		retVal = retVal.concat("rs2="+ this.getRs2() + ", ");
		retVal = retVal.concat("rs3="+ this.getRs3() + ", ");
		retVal = retVal.concat("rs4="+ this.getRs4() + ", ");
		retVal = retVal.concat("crackBias="+ this.getCrackBias() + ", ");
		retVal = retVal.concat("gx="+ this.getGx() + ", ");
		retVal = retVal.concat("gy="+ this.getGy() + ", ");
		retVal = retVal.concat("gz="+ this.getGz() + ", ");
		retVal = retVal.concat("mx="+ this.getMx() + ", ");
		retVal = retVal.concat("my="+ this.getMy() + ", ");
		retVal = retVal.concat("mz="+ this.getMz() + ", ");
		retVal = retVal.concat("thupX="+ this.getThupX() + ", ");
		retVal = retVal.concat("thupY="+ this.getThupY() + ", ");
		retVal = retVal.concat("thupZ="+ this.getThupZ() + ", ");
		retVal = retVal.concat("ltaInterSample="+ this.getLtaInterSample() + ", ");
		retVal = retVal.concat("rs5="+ this.getRs5() + ", ");
		retVal = retVal.concat("rs6="+ this.getRs6());
		if(this.getTapsx() != null){
			int i = 0;
			retVal = retVal.concat(", tapsx = NEW(CONSTANTVECTORINTEGER, \"");
			int taps[] = this.getTapsx();
			for(i = 0; i < (taps.length - 1) ; i++){
				retVal = retVal.concat(taps[i] + ", ");
			}
			retVal = retVal.concat(taps[taps.length - 1] +"\")");
		}
	
		if(this.getTapsy() != null){
			int i = 0;
			retVal = retVal.concat(", tapsy = NEW(CONSTANTVECTORINTEGER, \"");
			int taps[] = this.getTapsy();
			for(i = 0; i < (taps.length - 1) ; i++){
				retVal = retVal.concat(taps[i] + ", ");
			}
			retVal = retVal.concat(taps[taps.length - 1] +"\")");
		}
		
		if(this.getTapsz() != null){
			int i = 0;
			retVal = retVal.concat(", tapsy = NEW(CONSTANTVECTORINTEGER, \"");
			int taps[] = this.getTapsz();
			for(i = 0; i < (taps.length - 1) ; i++){
				retVal = retVal.concat(taps[i] + ", ");
			}
			retVal = retVal.concat(taps[taps.length - 1] +"\")");
		}
		return retVal;
	}

	public MRP getParameter() {
		return parameter;
	}
}
